package com.springcloud.service;

import com.springcloud.pojo.Dept;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @ProjectName: springcloud_day1
 * @Package: com.springcloud.service
 * @ClassName: DeptClientServiceFallbackFactory
 * @Author: 郑涛
 * @Description: 服务降级
 * @Date: 2020/10/24 10:00
 * @Version: 1.0
 */
@Component
public class DeptClientServiceFallbackFactory implements FallbackFactory {
    @Override
    public DeptClientService create(Throwable throwable) {

        return new DeptClientService() {
            @Override
            public boolean addDept(Dept dept) {
                return false;
            }

            @Override
            public List<Dept> QueryAll() {
                return null;
            }

            @Override
            public Dept getById(Long id) {
                return new Dept().setDeptno(id).setDname("error!!!!!!"+":"+"jiangji").setDb_source(null);
            }
        };
    }
}
